/**
 * Created by yy on 2017/8/17.
 */
$(function(){
    var url = server + '/server/authentication/identity.json';
    $.post(url, function(data){
        if (data.code == 12000) {
            alert("登录超时");
            window.location.replace('../../login.html');
        }
        if(data.code==20001){
            var ctx = template('./id-card-tpl', data);
            $("#id-card").html(ctx);
        }
        hasID();
    });



});

//判断身份证是否已添加
function hasID(){
    var idBox1=$('.card-box:nth-child(1)');
    var idBox2=$('.card-box:nth-child(2)');

    if(idBox1.find('h6').text()!==''){
        idBox2.addClass('hidden');
        idBox1.css('display','block');
        $('.add-card').css('display','none');
    }
    else{
        $('.add-card').css('display','block');
        idBox2.removeClass('hidden');
        idBox1.css('display','none');
        $('#card-status').html('添加身份证');
    }

}